export default function debounce(func: any, wait = 500) {
  let timer: any = null;
  const that = this;
  return function () {
    clearTimeout(timer);

    timer = setTimeout(() => {
      func.apply(that, arguments);
      timer = null;
    }, wait);
  };
}
